package com.nt.test.controller;

import com.nt.test.entity.Form;
import com.nt.test.service.FormService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

@RestController
@Controller
public class FormController {

    @Autowired
    private FormService formService;

    @RequestMapping(value = "/addForm",method = RequestMethod.POST)
    public int addForm(@RequestBody Form form){
        return formService.addForm(form);
    }

    @RequestMapping(value = "/listForms")
    public List<Form> listForms(){
      return formService.listFroms();
    };
}
